import { Pipe, PipeTransform } from '@angular/core';
import * as moment from 'moment';

/**
 * Generated class for the MyDatePipe pipe.
 *
 * See https://angular.io/docs/ts/latest/guide/pipes.html for more info on
 * Angular Pipes.
 */
@Pipe({
    name: 'myDate',
})
export class MyDatePipe implements PipeTransform {
    /**
     * Takes a value and makes it lowercase.
     */
    transform(value: string | number, format: string) {
        if (value === null || value === '' || value === '0001-01-01T00:00:00' || value === 0 || typeof (value) == 'number' && isNaN(value) || typeof (value) == 'undefined') {
            return '-';
        }
        return moment(value).format(format);
        //    moment('2027-09-23T10:46:30.7404642').format('YYYY-MM-DD HH:mm:ss')
    }
}
